import {Component, OnInit,ViewChild} from '@angular/core';
import  {ListService} from '../serves/list.service';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
  title: string = '123123'
  list:Array<String>  |undefined

  clickFun(e:Event){
    console.log(e)
    alert("hello")
  }

  @ViewChild('titleDOm')
  child: any;

  addListFun(value:string){
    console.log(value)
    this.list?.push(value)
  }

  addFun(){
    this.child.addBtnFun();
  }

  addNode(){
    this.listService.addList('Node')
  }

  constructor(private listService:ListService) {

  }
  ngOnInit(): void {
   // console.log(this.listService)
    this.list = this.listService.getList()
    console.log(this.list)
  }

  changeTitle(){
    this.title = "11"
  }
}
